/**
 * StaticData 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-20
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.StaticData;
import com.chnbst.bstyun.service.StaticDataService;

@Transactional
@Service
public class StaticDataServiceImpl extends BaseService implements StaticDataService {
	
	//声明命名空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.StaticDataMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteStaticData(Integer staticDataId) {
		return DaoHelper.delete(nameSpace, "deleteStaticData", staticDataId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertStaticData(StaticData staticData) {
		return DaoHelper.insert(nameSpace, "insertStaticData", staticData);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateStaticData(StaticData staticData) {
		return DaoHelper.update(nameSpace, "updateStaticData", staticData);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<StaticData> selectStaticDataByStaticDataCode(
			String staticDataCode) {
		return (List<StaticData>)DaoHelper.list(nameSpace, "selectStaticDataByStaticDataCode", staticDataCode);
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<StaticData> selectStaticDataByParentCode(Map<String, Object> map) {
		return  (List<StaticData>)DaoHelper.list(nameSpace, "selectStaticDataByParentCode", map);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public StaticData selectStaticData(Integer staticDataId) {
		return (StaticData)DaoHelper.query(nameSpace, "selectStaticData", staticDataId);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public StaticData selectStaticDataByCondition(Map<String, Object> map) {
		return (StaticData)DaoHelper.query(nameSpace, "selectStaticDataByCondition", map);
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<StaticData> selectStaticDataListByParentCode(
			Map<String, Object> map) {
		return (List<StaticData>)DaoHelper.list(nameSpace, "selectStaticDataListByParentCode", map);
	}
}
